﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Tool.Web.HttpHelper;

namespace Core.Function
{
	class Other
	{
		public static string GetHitokoto()
		{
			//https://api.imjad.cn/hitokoto?encode=json&charset=utf-8
			var data = HttpNet.Get("https://api.imjad.cn/hitokoto?encode=json&charset=utf-8");
			if (data.Length == 0) return "没有获取到结果，可能是API维护";
			var json = JObject.Parse(Encoding.UTF8.GetString(data));
			return $"一言：{json["hitokoto"]}\n出处：{json["source"]}\n类型：{json["catname"]}";
		}
	}
}
